home *** CD-ROM | disk | FTP | other *** search
- #define NO_TNOSFOPEN
- #include "global.h"
- #include "hardware.h"
- #undef fopen
- #undef fclose
-
- #ifndef _lint
- static char rcsid[] OPTIONAL = "$Id: deldep.c,v 1.10 1997/07/31 00:44:20 root Exp root $";
- #endif
-
- #define OBJ "o"
-
-
- int
- main(int argc,char *argv[])
- {
- int i, found;
- FILE *fp;
- char buf[512],buf2[512],origname[512],*cp;
-
- if (argc < 3) {
- printf ("deldep: no files given!\nusage: deldep searchstr <file> [<file> ...]\n");
- return 1;
- }
- for(i=2;i<argc;i++){
- strcpy(buf,argv[i]);
- if((cp = strchr(buf,'.')) == NULL)
- continue;
- strcpy (origname, buf);
- *cp = '\0';
- fp = fopen(argv[i],"r");
- found = 0;
- if (fp) {
- while(fgets(buf2,512,fp) != NULL){
- if(strstr(buf2,argv[1]) == 0)
- continue;
- found = 1;
- sprintf (buf2, "%s.%s", buf, OBJ);
- unlink (buf2);
- break;
- }
- if (found)
- printf("%s: deleted %s.%s ...\n", origname, buf, OBJ);
- fclose(fp);
- }
- }
- return 0;
- }
-
-